﻿@using Abp.Application.Services.Dto;
@using FwProject.Core.TypeNumber
@using FwProject.Restaurant.Dto
@using FwProject.TypeNumber.Dto
@model LoadCarInputDto
@{
    ViewBag.Title = "装车录入";
}
@section styles{
    <link href="~/Theme/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="~/Theme/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <style type="text/css">
        .input-group[class*=col-] {
            padding: 0 15px;
        }
    </style>
}
<div class="row wrapper wrapper-content animated fadeInRight">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>@ViewBag.Title</h5>
                <div class="ibox-tools">
                </div>
            </div>
            <div class="ibox-content" style="height:700px">
                <div class="row m-b-sm m-t-sm">
                    <form class="form-horizontal" asp-controller="Distribution" asp-action="CreateLoadCar" data-ajax="true" data-ajax-update="#data_list" data-ajax-method="post" data-ajax-mode="replace" data-ajax-success="ReloadAjaxCallbackgoback" data-ajax-failure="FailureAjaxCallback">
                        <div class="form-group">
                            <div class="col-md-4">
                                <label class="control-label col-md-3">单号：</label>
                                <div class="input-group">
                                    <input type="text" name="" class="input-sm form-control" value="系统自动生成" readonly="readonly">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <label class="control-label col-md-3">装车日期：</label>
                                <div class="input-group">
                                    <input type="text" name="CreationTime" id="CreationTime" class="input-sm form-control" value="@DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <label class="control-label col-md-3">配送司机：</label>
                                <div class="input-group">
                                    <select class="input-s-lg form-control" name="DriverId">
                                        @{ var i = 0;}
                                        @foreach (var item in ViewBag.Driver)
                                        {
                                            if (i == 0)
                                            {
                                                <option selected="selected" value="@item.Id">@item.Name</option>

                                            }
                                            else
                                            {
                                                <option value="@item.Id">@item.Name</option>

                                            }
                                            i++;

                                        }
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div id="data_list">
                            <table class="table table-bordered table-hover table-rowselected">
                                <thead>
                                    <tr>
                                        <th>货品型号</th>
                                        <th>装车数</th>
                                        <th>单位</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @{var n = 0; }
                                    @foreach (var item in (List<TypeNumberInfoDto>)ViewBag.TypeNumber)
                                    {
                                        <tr>
                                            <td>
                                                <input type="hidden" name="LoadingCarInputs[@n].TypeNumberInfoId" value="@item.Id">

                                                @*@Html.DropDownListFor(o=>o.LoadingCarInputs[0].TypeNumberInfoId, ViewBag.TypeNumber as IEnumerable<SelectListItem>, new { @class = "form-control" })*@
                                                <input type="text" name="LoadingCarInputs[@n].TypeNumberName" value="@item.Name" class="input-sm form-control" readonly="readonly" />
                                            </td>
                                            <td>
                                                <input type="text" name="LoadingCarInputs[@n].Countproduct" value="0" class="input-sm form-control" />
                                            </td>
                                            <td>@item.Unit</td>
                                        </tr>
                                        n++;
                                    }
                                </tbody>
                            </table>
                        </div><br />
                        <div class="ibox-tools">
                            <button type="submit" class="btn btn-primary btn btn-sm">确认录入</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@section scripts{
    <script src="~/Theme/js/content.min.js?v=1.0.0"></script>
    <script src="~/Theme/js/plugins/iCheck/icheck.min.js"></script>
    <script src="~/Theme/js/plugins/datapicker/bootstrap-datepicker.js"></script>
    <script src="~/Theme/js/plugins/suggest/bootstrap-suggest2014.js"></script>
    <script src="~/js/DateComm.js"></script>

    <script>
        $(document).ready(function () {
            $('#CreationTime').datepicker({
                todayBtn: "linked",
                autoclose: true,
                todayHighlight: true,
                endDate: new Date()

            });
        });
        function ReloadAjaxCallbackgoback(data, successInfo) {
            CommonAjaxCallback(data, function () {
                window.location = "/Distribution/ExamineLoadingCar?id=" + data.result;
            }, successInfo);
        }
    </script>

}
